var calendar = require('{plus}/calendar');

return renders({
    <%var required = ''%>
    <%if path?? && path === '/create/'%>
    <%var required = '<b class="f-cred">*</b>'%>
    <%/if%>

    <form class="ui-form<%if !required%> e-pt10 e-pb20<%/if%>" onsubmit="return false">
        <input type="hidden" name="id" value="<%id??%>">
        <div class="ui-item e-mt20">
            <label class="ui-label ui-label-pos f-lh35 f-tac">企业名称</label>
            <div class="f-fl f-pr">
                <input type="text" name="name" class="ui-input ui-input-normal" 
                value="<%name??%>" 
                data-rule-required="true" 
                <%var text = '请输入企业名称'%> 
                data-msg-required="<%text%>"
                autocomplete="off" data-placeholder-options='{"text":"<%text%>"}'>
                <em class="ui-err"></em>
            </div>
            <%required%>
        </div>
        <div class="ui-item e-mt20">
            <label class="ui-label ui-label-pos f-lh35 f-tac">企业税号</label>
            <div class="f-fl f-pr">
                <input type="text" name="tax" class="ui-input ui-input-normal" 
                value="<%tax??%>" 
                data-rule-required="true" 
                data-rule-taxnum="true" 
                <%var text = '请输入企业税号'%>
                data-msg-required="<%text%>"
                autocomplete="off" data-placeholder-options='{"text":"<%text%>"}'>
                <em class="ui-err"></em>
            </div>
            <%required%>
        </div>
        <div class="ui-item checkbox e-mt20">
            <label class="ui-label f-lh35 f-tac">纳税类别</label> 
            <%if !required%><div class="f-fl f-pr"><%/if%>
                <span class="ui-checkradio ui-checkradio-hooks<%if required%> ui-checkradio-large <%else%><%/if%> e-mr20">
                    <input type="radio" name="taxType" value="0" 
                    <%if taxType?? && taxType == '0'%>
                    checked="checked" 
                    <%/if%>
                    data-rule-required="true"
                    data-msg-required="请选择纳税类别">
                    <s class="iconfont">&#xe635;</s>
                    <b>一般纳税人</b>
                </span>
                <span class="ui-checkradio ui-checkradio-hooks<%if required%> ui-checkradio-large<%/if%>">
                    <input type="radio" name="taxType" value="1"
                    <%if taxType?? && taxType == '1'%>
                    checked="checked" 
                    <%/if%>
                    data-rule-required="true"
                    data-msg-required="请选择纳税类别">
                    <s class="iconfont">&#xe635;</s>
                    <b>小规模纳税人</b>
                </span>
            <%if !required%>
                <em class="ui-err"></em></div>
            <%else%>
                <em class="ui-err"></em>
            <%/if%>
            <%required%>
        </div>
        <div class="ui-item e-mt20">
            <label class="ui-label ui-label-pos f-lh35 f-tac">所属行业</label>
            <%if required%><div class="ui-input"><%/if%>
                <%if !required%><div class="f-fl f-pr"><%/if%>
                    <select name="industryId" class="f-dn" data-value="<%industryId??%>" data-rule-required="true" data-msg-required="请选择所属行业" data-css="width:<%if required%>343<%else%>286<%/if%>px">
                        <option value="">请选择所属行业</option>
                    </select>
                <%if !required%>
                    <em class="ui-err"></em>
                </div>
                <%/if%>
            <%if required%>
            </div>
            <%required%>
            <em class="ui-err"></em>
            <%/if%>
        </div>
        <div class="ui-item e-mt20">
            <label class="ui-label ui-label-pos f-lh35 f-tac">会计制度</label>
            <%if required%><div class="ui-input"><%/if%>
            <%if !required%><div class="f-fl f-pr"><%/if%>
                <select name="accounting" class="f-dn" data-value="<%accounting??%>" data-rule-required="true" data-msg-required="请选择会计制度" data-css="width:<%if required%>343<%else%>286<%/if%>px">
                    <option value="">请选择会计制度</option>
                    <option value="0">小企业会计准则(2013版)</option>
                    <option value="1">企业会计准则(2007版)</option>
                </select>
            <%if !required%>
                <em class="ui-err"></em>
            </div>
            <%/if%>
            <%if required%>
            </div>
            <%required%>
            <em class="ui-err"></em>
            <%/if%>
        </div>
        <div class="ui-item e-mt20">
            <label class="ui-label ui-label-pos f-lh35 f-tac">建账时间</label>
            <div class="f-fl f-pr">
                <input type="text" name="createDate" class="ui-input ui-input-normal"
                data-rule-required="true"
                <%var text = '请选择建账时间'%>
                data-msg-required="<%text%>"
                <%if year?? && month??%>
                <%
                    var mend = function(v){
                        if(v.toString().length === 1){
                            return '0'+v
                        }
                        return v
                    }
                %>
                <%var date = year+'-'+mend(month)%>
                <%else%>
                <%var date = $.calendar.date('yyyy-MM')%>
                <%/if%>
                value="<%date%>"
                autocomplete="off" readonly data-placeholder-options='{"text":"<%text%>"}'>
                <em class="ui-err"></em>
            </div>
            <%required%>
        </div>

        <%if required%>
        <div class="ui-item e-mt20 e-pt10">
            <button type="button" class="ui-button ui-button-blue ui-button-full ui-button-flat ui-button-large">创建账套</button>
        </div>
        <%/if%>
    </form>
})